

import { CloudDBZoneWrapper } from '../clouddb/CloudDBZoneWrapper.js';
import * as Utils from '../utils/Utils.js';
/**
 * 此接口方法专门用来更新Order状态，金额与传款时间的
 */
export const myHandler = async function (event, context, callback, logger) {
  const credential = Utils.getCredential(context, logger);
  try {
    const cloudDBZoneWrapper = new CloudDBZoneWrapper(credential, logger);
    let order = cloudDBZoneWrapper.getOrderInfo(event.order_id);
    await cloudDBZoneWrapper.updateOrderRecord(order, event.status, event.amount,event.pay_time);
    callback({
      ret: { code: 0, desc: "SUCCESS" },
    });
  } catch (err) {
    logger.error("func error:" + err.message + " stack:" + err.stack);
    callback({
      ret: { code: -1, desc: "ERROR" },
    });
  }
};
